package main

import (
	"fmt"
	"strings"
)

type Address struct {
	country, province, city string
}

type Person struct {
	name, gender string
	age          int
	Address
}

func (p *Person) ToString() string {
	var buf strings.Builder
	fmt.Fprintf(&buf, "Person{name=%s, gender=%s, age=%d, Address={country=%s, province=%s, city=%s}}",
		p.name, p.gender, p.age, p.Address.country, p.Address.province, p.Address.city)
	return buf.String()
}

func main() {
	var p1 = Person{
		name:   "Arthur",
		gender: "Male",
		age:    18,
		Address: Address{
			country:  "China",
			province: "SH",
			city:     "SH",
		},
	}

	fmt.Println(p1)

	fmt.Println(p1.ToString())
}
